<?php
namespace app\index\controller;
use \think\Session;

class Adm extends \think\Controller{
	public function index(){

	}
	public function admin(){

		$level=Session::get('user');  
		if(!empty($level)){
			$this->assign('username',$level->getName());
		 	if($level->getLevel() == 0){
		 		return $this -> fetch();
		 	}	
	    	if($level->getLevel() == 1)
	    	{   	
	            $this->redirect('http://127.0.0.1/index/Adm/staff');
	    	}
    	}else{
    		$this->redirect('http://127.0.0.1');
    	}

	}
	public function staff(){
		$level=Session::get('user');  
		if(!empty($level)){ 
			$this->assign('username',$level->getName());
		 	if($level->getLevel() == 0){
		 		$this->redirect('http://127.0.0.1/index/Adm/admin');
		 	}	
	    	if($level->getLevel() == 1)
	    	{   	
	            
				return $this -> fetch();
	    	}
    	}else{
    		$this->redirect('http://127.0.0.1');
    	}
	}
	public function userExit(){
		Session::clear();
		return Session::has('user');
	}
	public function manageUser(){
        return $this->fetch();
    }
    public function manageMaterial(){
        return $this->fetch();
    }
    public function getContent(){

    }
    public function getPageNum(){
        return db('user')->count();
    }
}